package com.by.controller;

import com.by.bean.Payment;
import com.by.bean.ResultBean;
import com.by.group.V;
import com.by.mapper.PaymentMapper;
import com.by.utils.Assert;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author :LYJ
 * @version : 1.0
 * @date : 2025/2/21 16:22
 * @desc :
 * @since : JDK17
 */
@RestController
@RequestMapping("/api")
@Api(tags = "货款")
public class PaymentController extends BaseController {
    @Autowired
    PaymentMapper paymentMapper;

    @PostMapping("/supplierPayment/save")
    @ApiOperation("货代信息部分保存")
    public ResultBean save(@Validated @RequestBody Payment payment, BindingResult bindingResult) {
        V.validate(bindingResult);
        int result = paymentMapper.save(payment);
        Assert.isZero(result, "祸都部分保存失败");
        return success("success", "货代部分保存成功");
    }
}
